	/**
     * The Review class will manage review text files.
     * 
     * @author - Robert Rankin
     * @author - Tom Netzer (Added constructor)
     * @author - Chandni Sabhaya (added methods - getReviewerName() ,getText() 
     * modified constructor, initialized it and commented it)
	 */

package caobject;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Serializable;
import java.util.Scanner;

public class Review implements Serializable
{
	/**
	 * Generated SV-UID
	 */
	private static final long serialVersionUID = -8609857383392904862L;

	/**
	 * the reviewer of this review.
	 */
	private User my_reviewer;
	
	/**
	 * the title of reviewed paper. 
	 */
	private String my_title_of_reviewed_paper;
	
	/**
	 * text.
	 */
	private String my_text;
	
	/**
	 * The public constructor. 
	 */
	public Review(User the_reviewer, 
			String the_titleOfPaperReviewed,
			String the_text){
		my_reviewer = the_reviewer;
		my_title_of_reviewed_paper = the_titleOfPaperReviewed;
		my_text = the_text;
	}
	
	/**
	 * Gets the reviewer's name. 
	 * 
	 * @return the name of the reviewer
	 */
	public String getReviewerName() {
		return my_reviewer.getUserName();
	}
	
	
	/**
	 * Gets the text. 
	 * 
	 * @return null if review is not submitted otherwise the text. 
	 */
	public String getText() {
		return my_text;
	}
	
	
	/**
     * The Review class will manage review text files.
	 */	
	String empty = new String("");
	boolean letterFound = false;
	Integer wlen = 0;
	
	public static StringBuilder getFileText(final File the_file) 
				throws FileNotFoundException, IOException
	{
		// Wrap a file scanner so we can use Scanner 
		// methods on the file.
		Scanner file = new Scanner( the_file );

		StringBuilder word = new StringBuilder();

		while(file.hasNext()) // read file word-by-word
		{
				// Scanner method next()
				word.append(file.next() + " ") ;		
		} // end while
		file.close();  // Close the file.

		return word;
	}
}
